# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Hyacinthe Cartiaux <hyacinthe.cartiaux AT free DOT fr>
# Contributor: Juan Diego Tascon
# Contributor: Tom Vincent <http://tlvince.com/contact/>

_gemname=rainbow
pkgname=ruby-${_gemname}
pkgver=3.1.1
pkgrel=1
pkgdesc="Rainbow is extension to ruby's String class adding support for colorizing text on ANSI terminal"
url='https://rubygems.org/gems/rainbow'
arch=('any')
license=('MIT')
depends=('ruby' 'ruby-rdoc')
options=('!emptydirs')
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/sickill/rainbow/archive/v${pkgver}.tar.gz)
sha256sums=('8ede18d7eb85a84c5c61d0136ca3715a2ff9150010cba9164f802e966c05f837')
sha512sums=('5aff955e8baf78d99960ec9caa11626f07460085f35966c410bb867dd6454a932d2ee8742729a32eeca186fa338bbb02bce3ee8a452a8b4fb0044bb6ec751bc3')

prepare() {
  cd ${_gemname}-${pkgver}
  sed -r 's|~>|>=|g' -i rainbow.gemspec # don't give a fuck about rubys bla bla
  sed -r 's|git ls-files|find|g' -i rainbow.gemspec
}

build() {
  cd ${_gemname}-${pkgver}
  gem build rainbow.gemspec
}

package() {
  cd ${_gemname}-${pkgver}
  local _gemdir="$(gem env gemdir)"
  gem install --ignore-dependencies --no-user-install -i "${pkgdir}/${_gemdir}" -n "${pkgdir}/usr/bin" rainbow*.gem
  install -Dm 644 README.markdown Changelog.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
  rm "${pkgdir}"/${_gemdir}/cache/${_gemname}-${pkgver}.gem
}

# vim: ts=2 sw=2 et:
